<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('留言回复')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<style>
    .table tr td {
        border:1px solid black;
    }
</style>
<body>
<!---写评论------>
<caption>留言回复</caption>
<form role="form">
    <div class="form-group col-sm-12">
        <input  id="msg" name="msg" type="text" class="form-control" placeholder="写下您的回复...."/>
    </div>
</form>
<caption>留言区</caption>
<div class="container" th:object="${leaveMsg}" style="background-color: #5bc0de;border: 1px solid">
    <input id="id" name="id"   type="hidden" hidden th:field="*{id}"   />
    <div class="row h5" >
        留言者昵称：<span th:text="*{createBy}"></span>
    </div>
    <div class="row h5" >留言时间：<span th:text="${#dates.format(leaveMsg.createTime, 'yyyy-MM-dd HH:mm')}"></span></div>
    <div class="row h5">
        留言内容:<h1 th:text="*{msg}"></h1>
    </div>
</div>
<!---留言区------>
<caption>回复区</caption>
<table border="1" class="table" th:each="reply: ${replyMsg}" style="background-color: #1e9fff;border: 1px solid">
    <tr>
        <td rowspan="3" th:text="*{reply.replayName}"></td>
    </tr>
    <tr>
        <td>回复内容:</td>
       <td th:text="*{reply.msg}"></td>
    </tr>
    <tr>
        <td>回复时间:</td>
       <td th:text="${#dates.format(reply.replyTime, 'yyyy-MM-dd HH:mm')}"></td>
    </tr>
</table>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
</body>
<script>
    function submitHandler() {
        replay();
    }

    function replay() {
        var msg = $("input[name='msg']").val();
        var id = $('#id').val();
        var formData = new FormData();
        formData.append('msg', msg);
        formData.append('id', id);
        $.ajax({
            processData: false,
            contentType: false,
            cache : false,
            type : "POST",
            url : ctx + "system/leaveMsg/reply",
            data :formData,
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }
</script>
</html>